<div class="fsh-pop">
    <div id="add_form" class="layui-form" lay-filter="add_form">
        <input type="hidden" id="user_id" name="user_id"/>
        <input type="hidden" id="school_user_id" name="school_user_id"/>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label"><i>*</i>用户名</label>
                <div class="layui-input-block">
                    <input type="text" name="nickname" lay-verify="required" readonly="readonly" class="layui-input"/>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label"><i>*</i>用户类型</label>
                <div class="layui-input-block">
                    <select id="dutySelect2" lay-filter="type" name="duty_id">
                    </select>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    layui.use(['form'], function () {
        var form = layui.form;
        var originData = JSON.parse($('<div>').html('<%=$data%>').text());
        var _eduSchoolUser = originData._eduSchoolUser || {};

        function iniForm() {
            $.ajax({
                type: 'get',
                url: context + "/api/sysDuty/list",
                success: function (response) {
                    var data = response.data;
                    if (typeof data == 'object') {
                        var select = $('#dutySelect2');
                        select.empty();
                        var t = '<option value="0">默认</option>';
                        for (var i = 0, n = data.length; i < n; i++) {
                            t += '<option value="' + data[i].duty_id + '">' + data[i].dutyName + '</option>';
                        }
                        select.append(t);
                        select.val(_eduSchoolUser.duty_id || 0);
                        form.render();
                    }
                }
            });
            form.val('add_form', originData);
            select = $('#school_user_id').val(_eduSchoolUser.school_user_id);
            // console.log(originData);

        };
        iniForm();

    });


</script>